function jumpGame(arr) {
    let minIndex = 0
    let min = arr[minIndex]
    while (minIndex < arr.length) {
        let max = 0
        if (min + minIndex >= arr.length - 1) {
            return true
        }
        if (min === 0) {
            return false
        }
        for (let j = minIndex; j <= min + minIndex; j++) {
            max = j + arr[j] > max ? j + arr[j] : max
        }
        let temp = minIndex
        minIndex = min + temp
        min = max - min - temp
        arr[min] = max - min
    }
    return false
}
console.log(jumpGame([2, 3, 1, 1, 4, 2, 2, 2, 2, 3, 4, 5, 2, 3, 0, 0, 0]))